package spt.test.utils;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * This class allows you to get resources.
 */
public class Resources {
	/**
	 * Returns resource as a string.
	 * @param name File name with resource from package spt.test.xml.
	 * @return Resource as a string - file content.
	 */
	public static String get(String name){
		String line;
		StringBuffer file = new StringBuffer();
		try {
			BufferedReader br = new BufferedReader(new FileReader("src/spt/test/xml/" + name));
			
			while((line = br.readLine()) != null){
				file.append(line);
			}
			
			br.close();
			
			return file.toString();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return null;
	}
}
